    //
// Created by vcq on 21/2/9.
//
#pragma once
#include "dbng.hpp"
struct _teachgoal_judge {
    int id;
    int _goal_id;
    int _judge_id;
    int _syllabus_id;
    double per;
    string note;
};
    REFLECTION(_teachgoal_judge, id, _goal_id, _judge_id, _syllabus_id, per, note)

    json
    MGetTeachGoalJudge(basic_string_view<char> id, basic_string_view<char> _goal_id, basic_string_view<char> _judge_id,
                       basic_string_view<char> _syllabus_id) {
        string sql = "select * from `_teachgoal_judge` where 1=1 ";
        if (!id.empty()) {
            sql += " and id =";
            sql += id;
        }
        if (!_goal_id.empty()) {
            sql += " and _goal_id =";
            sql += _goal_id;
        }
        if (!_judge_id.empty()) {
            sql += " and _judge_id =";
            sql += _judge_id;
        }
        if (!_syllabus_id.empty()) {
            sql += " and _syllabus_id =";
            sql += _syllabus_id;
        }
        Dao dao;
        nlohmann::json article_list, ret, item;
        auto v = dao.query<_teachgoal_judge>(sql);
        for (auto &o : v) {
            item["id"] = o.id;
            item["per"] = o.per;
            item["_goal_id"] = o._goal_id;
            item["_judge_id"] = o._judge_id;
            item["_syllabus_id"] = o._syllabus_id;
            item["note"] = o.note;
            article_list.push_back(item);
        }
    ret["code"] = 0;
    ret["count"] = article_list.size();
    ret["data"] = article_list;
    return ret;
}
void MAddTeachGoalJudge(const struct _teachgoal_judge& _teachgoal_judge1){
    Dao dao;
    dao.update_object(_teachgoal_judge1);
}
void MDeleteTeachGoalJudge(basic_string_view<char> id){
    MDeleteAll("_teachgoal_judge",id);
}